/*
created by chuyoujun at 2018-10-18
 路由配置文件

* */
import Vue from 'vue'
import Router from 'vue-router'
import home from '../components/home.vue';
import follow from '../components/follow';
import column from '../components/column.vue';
import reg from '../components/reg.vue';
import login from '../components/login.vue';
import articles from '../components/articles.vue';
import error from '../components/error.vue';
import test from '../components/test.vue';
import test2 from '../components/test2.vue';
import scroll from '../components/scroll.vue';

Vue.use(Router);

export default new Router({
  mode: 'hash',
  routes: [
    {
      name: 'home',
      path: '/home',
      component: home,
      meta: {
        keepAlive: false //此组件需要被缓存
      }
    },
    {
      path: '/follow',
      component: follow,
      meta: {
        keepAlive: false,//此组件需要被缓存
        isBack: false
      },
      children: [
        {
          name: 'test',
          path: '/follow/test',
          component: test,
        },
        {
          name: 'test2',
          path: '/follow/test2',
          component: test2,
        },
        {
          path: '/',
          redirect: '/follow/test'
        },
      ]
    },
    {
      path: '/column',
      component: column,
      meta: {
        keepAlive: false, //此组件需要被缓存
        isBack: false
      }
    },
    {
      name: 'reg',
      path: '/reg',
      component: reg,

    },
    {
      name: 'login',
      path: '/login',
      component: login,

    },
    {
      name: 'artdetail',
      path: '/articles',
      component: articles,
      meta: {
        keepAlive: true, //此组件需要被缓存
        isBack: false
      }
    },
    {
      name: 'scroll',
      path: '/scroll',
      component: scroll,
      meta: {
        keepAlive: false, //此组件需要被缓存
        isBack: false
      }
    },
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '*',
      component: error
    }
  ]
})
